﻿
// opencv_demo1.h: PROJECT_NAME 应用程序的主头文件
//

#pragma once

#include <opencv2/opencv.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc/types_c.h>
#include <opencv2/imgcodecs.hpp>

using namespace cv;

#if 1

//数字水印
class watermask_cv_dct
{
public:
	watermask_cv_dct();

	//加载实际图片大小
	int m_water_width = 0, m_water_height = 0;
	int m_blockLen = 8;  //图片分块长度
	double m_deep = 75.0;
	//int m_x = 2;  //水印嵌入位置
	//int m_y = 4;
	//int m_x2 = 3;  //水印嵌入位置
	//int m_y2 = 3;

	//从中间开始，往右上方走格子
	int m_x = m_blockLen / 2 - 1;  //水印嵌入位置
	int m_y = m_blockLen / 2;
	int m_x2 = m_blockLen - m_x;  //水印嵌入位置
	int m_y2 = m_blockLen - m_y;
	std::vector<int> m_watermask;

    //加载水印
	void loadWatermask(std::string waterMaskFile);
	bool has();
	
	//添加水印
	void addImageWatermarY(char * yuv,int _w,int _h);

	Mat addImageWatermarkWithText(Mat image);
	Mat addImageWatermarkWithText(Mat image, std::vector<int> &watermark, int waterMarkLen, double p);
	Mat addImageWatermarY(Mat imageY);
	Mat addImageWatermarY(Mat imageY, std::vector<int>& watermark, int waterMarkLen, double p);

	Mat getImageWatermarkWithText(Mat image, int water_w, int water_h);

	std::vector<int> getInformationOfBinaryGraph(String srcPath); //获得水印文件的位图信息（0/1）
	void matrixToBinaryPhoto(std::vector<int>& watermark, String dstPath);  //没有使用

	Mat getBlock(Mat YMat, int index, int blockLen);
	void saveBlock(Mat YMat, Mat& blockMat,int index, int blockLen);
};

//人脸识别
class cv_face_find
{
public:
	static cv_face_find* getInstance();
	void load();
	void findface(char* yuv, int _w, int _h);

	int  m_index = 0;  //间隔检测，降低开销。20个检测一个
	std::vector<cv::Rect> m_faces;
	//人脸检测的类
	cv::CascadeClassifier faceCascade;
};

//贴图
class cv_map_picture
{
public:
	cv_map_picture() {}
	void loadpic();

	void test(char *yuv ,int _w,int _h);

	cv::Mat m_smallpic;  //需要贴的图片
};



#endif